#include "Solution.h"
#include <iostream>
using namespace std;
int main()
{
	int m,n;
	cin>>m>>n;
	int* A = new int[m+n];
	int* B = new int[n];
	for(int i=0;i<m;i++)
		cin>>A[i];
	for(int i=0;i<n;i++)
		cin>>B[i];

	Solution s;
	s.merge(A,m,B,n);
	for(int i=0;i<(m+n);i++)
		cout<<A[i]<<" ";

	while(cin.get() != '\n');
	cin.get();
}